//
//  LSCurrencySelectCell.m
//  lightSpot
//
//  Created by lightSpot on 2022.
//  Copyright © 2022年 lightSpot. All rights reserved.
//

#import "LSCurrencySelectCell.h"

@implementation LSCurrencySelectCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setData:(id)data delegate:(id)delegate {
    _delegate = delegate;
    
    if ([data isKindOfClass:[NSDictionary class]]) {
        if ([data[@"data"] isKindOfClass:[LSCurrencySelectCellModel class]]) {
            LSCurrencySelectCellModel *model = data[@"data"];
            _model = model;
            _titleLabel.text = model.title;
            
            if ([model.title isEqualToString:@"服务条款"]) {
                _viewTop.constant = 0;
                _viewBottom.constant = -15;
                _lineLabel.hidden = NO;
            } else if ([model.title isEqualToString:@"隐私政策"]) {
                _viewTop.constant = -15;
                _viewBottom.constant = 0;
                _lineLabel.hidden = YES;
            }
        }
    }
}

- (IBAction)buttonAction:(UIButton *)sender {
    if (_delegate && [_delegate respondsToSelector:@selector(currencySelectCell:button:)]) {
        [_delegate currencySelectCell:self button:sender];
    }
}

@end


#pragma mark - Model

@implementation LSCurrencySelectCellModel

+ (LSCurrencySelectCellModel *)ittemModelWithTitle:(NSString *)title {
    LSCurrencySelectCellModel *model = [LSCurrencySelectCellModel new];
    model.title = kSafeString(title);
    return model;
}

@end
